filechooser: Fix a crash when removing files
authorBenjamin Otte <otte@redhat.com>
Sun, 2 May 2010 12:32:18 +0000 (14:32 +0200)
committerBenjamin Otte <otte@redhat.com>
Sun, 2 May 2010 12:34:43 +0000 (14:34 +0200)
The file removal code was not properly clearing the file=>array index
cache, so later lookups into that cache would return invalid array
indexes.

The easiest way to reproduce it is to create a directory with two files
and deleting both of them.

Reported-by: Javier Jardón <jjardon@gnome.org>
gtk/gtkfilesystemmodel.c

index b3328e02f9a089eae58d90b843c16a17881d9ba8..738b06156379d7ef60eee91554b84fc3c47f19d1 100644 (file)
@@ -1747,6 +1747,7 @@ remove_file (GtkFileSystemModel *model,
     g_object_unref (node->info);
 
   g_array_remove_index (model->files, id);
+  g_hash_table_remove_all (model->file_lookup);
   /* We don't need to resort, as removing a row doesn't change the sorting order */
 }